<?php

namespace App\Entities;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

class Patient extends Model implements Transformable
{
    use TransformableTrait;

    protected $fillable = ['name', 'sex', 'age', 'phone', 'qq', 'wechat', 'content', 'patient_type_id', 'deportment_id', 'media_id', 'zone_id', 'expert_number', 'push_date', 'intro', 'back_intro', 'come_state', 'come_date', 'doctor_id', 'user_id'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function patientType(){
        return $this->hasOne('App\Entities\PatientType', 'id', 'patient_type_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function deportment(){
        return $this->hasOne('App\Entities\Deportment', 'id', 'deportment_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function media(){
        return $this->hasOne('App\Entities\Media', 'id', 'media_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function zone(){
        return $this->hasOne('App\Entities\Zone', 'id', 'zone_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function doctor(){
        return $this->hasOne('App\Entities\Doctor', 'id', 'doctor_id');
    }

    public function user(){
        return $this->hasOne('App\User', 'id', 'user_id');
    }
}
